package com.ce.thd;

import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.ProgressBar;

public class UpdateProgressThread extends Thread {
	private Display display;
	private ProgressBar progressBar;
	int i = 0;
	public UpdateProgressThread(Display display, ProgressBar progressBar) {
		this.display = display;
		this.progressBar = progressBar;
	}

	@Override
	public void run() {
		try {
			for (i = 0; i <= 10; i++) {
				Thread.sleep(1000);
				if(!this.display.isDisposed()) {
					Runnable runnable = new Runnable() {
						public void run() {
							progressBar.setSelection(10*i);
						}
					};
					display.asyncExec(runnable); 
				}
				
				
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}
